﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    /// <summary>
    /// 消火栓巡检 控制器
    /// </summary>
    public class FireHydrantController : ApiController
    {
        private FireHydrantQuery fhdq;
        private FireHydrant firehd;

        [POST("GetFireHydrants")]
        public IList<FireHydrantQuery> PostGetFireHydrants(FireHydrantCondition fhc)
        {
            fhdq = new FireHydrantQuery();
            return fhdq.GetFireHydrantQuerys(fhc);
        }

        /*
        [POST("GetFireHydrantsCount")]
        public int PostGetFireHydrantsCount(FireHydrant info)
        {
            var where = FireHydrantWhere(info);
            int count = rep.LoadCount(where);
            return count;
        }
        */

        [POST("AddFireHydrant")]
        public bool PostAddFireHydrant(FireHydrant info)
        {
            info.MRNO = BuilderMrno.GetMrnoFortbl("Tbt_FireHydrant");
            firehd = new FireHydrant();
            bool result = firehd.AddFireHydrant(info) > 0 ? true : false;
            return result;
        }

        /*
        [POST("EditFireHydrant")]
        public bool PostEditFireHydrant(FireHydrant info)
        {
            bool result = rep.Edit(info);
            return result;
        }

        [GET("DeleteFireHydrant/{code}")]
        public bool GetDeleteFireHydrant(string code)
        {
            bool result = rep.Delete(code);
            return result;
        }

        [GET("GetFireHydrant/{code}")]
        public FireHydrant GetFireHydrant(string code)
        {
            var result = rep.Get(code);
            return result;
        }
         */
    }
}
